﻿#region System Namespace
using System;
using System.Collections.Generic;
using System.Linq;
using System.IO;
using System.Threading;
#endregion System Namespace

#region Foreign Namespace

#endregion Foreign Namespace

#region Styx Namespace
using Styx;
using Styx.Plugins.PluginClass;
using Styx.Helpers;
using Styx.Logic;
using Styx.Logic.AreaManagement;
using Styx.Logic.BehaviorTree;
using Styx.Logic.Combat;
using Styx.Logic.Inventory;
using Styx.Logic.Inventory.Frames.Gossip;
using Styx.Logic.Inventory.Frames.Quest;
using Styx.Logic.Inventory.Frames.LootFrame;
using Styx.Logic.Pathing;
using Styx.Logic.Profiles;
using Styx.Plugins;
using Styx.WoWInternals;
using Styx.WoWInternals.Misc;
using Styx.WoWInternals.World;
using Styx.WoWInternals.WoWObjects;
#endregion Styx Namespace


namespace Blacksmithing
{
    public class Blacksmith : HBPlugin
    {
        public class blacksmithingLevel
        {
            public int bsLevel = StyxWoW.Me.GetSkill(164).CurrentValue;
            public string bs = "CastSpellByName('Blacksmithing')";
        }

        public class trainValues
        {
            public List<WoWUnit> WoWUnitList = ObjectManager.GetObjectsOfType<WoWUnit>();
            public uint TrainAllianceNPCEntry = 5511;
            public uint TrainHordeNPCEntry = 3355;
        }

        public class listValues
        {
            public List<WoWItem> item = intMe.BagItems;
        }

        public class stage1Values
        {
            public uint L75 = 2018;

            public uint roughStone = 2835;
            public uint copperBar = 2840;

            public string Thirty = "local i=1 while GetTradeSkillInfo(i) do if GetTradeSkillInfo(i) ==\"Rough Sharpening Stone\" then DoTradeSkill(i,1) break end i=i+1 end";
            public string SixtyFour = "local i=1 while GetTradeSkillInfo(i) do if GetTradeSkillInfo(i) ==\"Rough Grinding Stone\" then DoTradeSkill(i,1) break end i=i+1 end";
            public string SeventyFour = "local i=1 while GetTradeSkillInfo(i) do if GetTradeSkillInfo(i) ==\"Copper Chain Belt\" then DoTradeSkill(i,1) break end i=i+1 end";
            public string EightyNine = "local i=1 while GetTradeSkillInfo(i) do if GetTradeSkillInfo(i) ==\"Coarse Grinding Stone\" then DoTradeSkill(i,1) break end i=i+1 end";
            public string NinityNine = "local i=1 while GetTradeSkillInfo(i) do if GetTradeSkillInfo(i) ==\"Runed Copper Belt\" then DoTradeSkill(i,1) break end i=i+1 end";
        }

        public class stage2Values
        {
            public uint L125 = 3100;
            public uint L200 = 3538;

            public uint heavyStone = 2838;
            public uint bronzeBar = 2841;
            public uint goldBar = 3577;
            public uint ironBar = 3575;
            public uint heavyGrindingStone = 3486;
            public uint greenDye = 2605;
            public uint steelBar = 3859;
            public uint coarseStones = 2836;
            public uint copperBar = 2840;
            public uint silverBar = 2842;
            public uint roughGrindingStone = 3470;
            public uint coarseGrindingStone = 3478;

            public string EightyNine = "local i=1 while GetTradeSkillInfo(i) do if GetTradeSkillInfo(i) ==\"Coarse Grinding Stone\" then DoTradeSkill(i,1) break end i=i+1 end ";
            public string NinityNine = "local i=1 while GetTradeSkillInfo(i) do if GetTradeSkillInfo(i) ==\"Runed Copper Belt\" then DoTradeSkill(i,1) break end i=i+1 end ";

            public string OneHundredAndSix = "local i=1 while GetTradeSkillInfo(i) do if GetTradeSkillInfo(i) ==\"Silver Rod\" then DoTradeSkill(i,1) break end i=i+1 end ";
            public string OneHundredAndNine = "local i=1 while GetTradeSkillInfo(i) do if GetTradeSkillInfo(i) ==\"Runed Copper Belt\" then DoTradeSkill(i,1) break end i=i+1 end ";
            public string OneHundredAndTwentyFour = "local i=1 while GetTradeSkillInfo(i) do if GetTradeSkillInfo(i) ==\"Rough Bronze Shoulders\" then DoTradeSkill(i,1) break end i=i+1 end ";
            public string OneHundredAndThirtyNine = "local i=1 while GetTradeSkillInfo(i) do if GetTradeSkillInfo(i) ==\"Heavy Sharpening Stone\" then DoTradeSkill(i,1) break end i=i+1 end ";
            public string OneHundredAndFourtyFour = "local i=1 while GetTradeSkillInfo(i) do if GetTradeSkillInfo(i) ==\"Rough Bronze Shoulders\" then DoTradeSkill(i,1) break end i=i+1 end ";
            public string OneHundredAndFourtyNine = "local i=1 while GetTradeSkillInfo(i) do if GetTradeSkillInfo(i) ==\"Patterned Bronze Bracers\" then DoTradeSkill(i,1) break end i=i+1 end ";
            public string OneHundredAndFiftyFour = "local i=1 while GetTradeSkillInfo(i) do if GetTradeSkillInfo(i) ==\"Golden Rod\" then DoTradeSkill(i,1) break end i=i+1 end ";
            public string OneHundredAndSixtyFour = "local i=1 while GetTradeSkillInfo(i) do if GetTradeSkillInfo(i) ==\"Green Iron Leggings\" then DoTradeSkill(i,1) break end i=i+1 end ";
            public string OneHundredAndEightyNine = "local i=1 while GetTradeSkillInfo(i) do if GetTradeSkillInfo(i) ==\"Green Iron Bracers\" then DoTradeSkill(i,1) break end i=i+1 end ";
            public string OneHundredAndNinityNine = "local i=1 while GetTradeSkillInfo(i) do if GetTradeSkillInfo(i) ==\"Golden Scale Bracers\" then DoTradeSkill(i,1) break end i=i+1 end ";
        }

        public class stage3Values
        {
            public uint L125 = 3100;
            public uint L200 = 3538;

            public uint heavyStone = 2838;
            public uint bronzeBar = 2841;
            public uint coarseGrindingStone = 3478;
            public uint goldBar = 3577;
            public uint ironBar = 3575;
            public uint heavyGrindingStone = 3486;
            public uint greenDye = 2605;
            public uint steelBar = 3859;

            public string TwoHundredAndNine = "local i=1 while GetTradeSkillInfo(i) do if GetTradeSkillInfo(i) ==\"Solid Sharpening Stone\" then DoTradeSkill(i,1) break end i=i+1 end ";
            public string TwoHundredAndTwentyFour = "local i=1 while GetTradeSkillInfo(i) do if GetTradeSkillInfo(i) ==\"Heavy Mithril Gauntlet\" then DoTradeSkill(i,1) break end i=i+1 end ";
            public string TwoHundredAndThirtyFour = "local i=1 while GetTradeSkillInfo(i) do if GetTradeSkillInfo(i) ==\"Mithril Scale Bracers\" then DoTradeSkill(i,1) break end i=i+1 end ";
            public string TwoHundredAndFourtyNine = "local i=1 while GetTradeSkillInfo(i) do if GetTradeSkillInfo(i) ==\"Mithril Coif\" then DoTradeSkill(i,1) break end i=i+1 end ";
            public string TwoHundredAndFiftyNine = "local i=1 while GetTradeSkillInfo(i) do if GetTradeSkillInfo(i) ==\"Dense Sharpening Stone\" then DoTradeSkill(i,1) break end i=i+1 end ";
            public string TwoHundredAndSeventyFour = "local i=1 while GetTradeSkillInfo(i) do if GetTradeSkillInfo(i) ==\"Thorium Bracers\" then DoTradeSkill(i,1) break end i=i+1 end ";
            public string TwoHundredAndEightyNine = "local i=1 while GetTradeSkillInfo(i) do if GetTradeSkillInfo(i) ==\"Imperial Plate Bracers\" then DoTradeSkill(i,1) break end i=i+1 end ";
            public string TwoHundredAndNinityNine = "local i=1 while GetTradeSkillInfo(i) do if GetTradeSkillInfo(i) ==\"Thorium Boots\" then DoTradeSkill(i,1) break end i=i+1 end ";
        }

        public class stage4Values
        {
            public uint L300 = 9785;

            public uint solidStone = 7912;
            public uint mithrilBar = 3860;
            public uint mageweaveCloth = 4338;
            public uint denseStone = 12365;
            public uint thoriumBar = 12359;
            public uint ruggedLeather = 8170;

            public string TwoHundredAndNine = "local i=1 while GetTradeSkillInfo(i) do if GetTradeSkillInfo(i) ==\"Solid Sharpening Stone\" then DoTradeSkill(i,1) break end i=i+1 end ";
            public string TwoHundredAndTwentyFour = "local i=1 while GetTradeSkillInfo(i) do if GetTradeSkillInfo(i) ==\"Heavy Mithril Gauntlet\" then DoTradeSkill(i,1) break end i=i+1 end ";
            public string TwoHundredAndThirtyFour = "local i=1 while GetTradeSkillInfo(i) do if GetTradeSkillInfo(i) ==\"Mithril Scale Bracers\" then DoTradeSkill(i,1) break end i=i+1 end ";
            public string TwoHundredAndFourtyNine = "local i=1 while GetTradeSkillInfo(i) do if GetTradeSkillInfo(i) ==\"Mithril Coif\" then DoTradeSkill(i,1) break end i=i+1 end ";
            public string TwoHundredAndFiftyNine = "local i=1 while GetTradeSkillInfo(i) do if GetTradeSkillInfo(i) ==\"Dense Sharpening Stone\" then DoTradeSkill(i,1) break end i=i+1 end ";
            public string TwoHundredAndSeventyFour = "local i=1 while GetTradeSkillInfo(i) do if GetTradeSkillInfo(i) ==\"Thorium Bracers\" then DoTradeSkill(i,1) break end i=i+1 end ";
            public string TwoHundredAndEightyNine = "local i=1 while GetTradeSkillInfo(i) do if GetTradeSkillInfo(i) ==\"Imperial Plate Bracers\" then DoTradeSkill(i,1) break end i=i+1 end ";
            public string TwoHundredAndNinityNine = "local i=1 while GetTradeSkillInfo(i) do if GetTradeSkillInfo(i) ==\"Thorium Boots\" then DoTradeSkill(i,1) break end i=i+1 end ";
        }

        public class stage5Values
        {
            public uint L350 = 29844;

            public uint felIronBar = 23445;
            public uint netherweaveCloth = 21877;
            public uint adamantiteBar = 23446;

            public string ThreeHundredAndFour = "local i=1 while GetTradeSkillInfo(i) do if GetTradeSkillInfo(i) ==\"Fel Weightstone\" then DoTradeSkill(i,1) break end i=i+1 end ";
            public string ThreeHundredAndFourteen = "local i=1 while GetTradeSkillInfo(i) do if GetTradeSkillInfo(i) ==\"Fel Iron Plate Belt\" then DoTradeSkill(i,1) break end i=i+1 end ";
            public string ThreeHundredAndNineteen = "local i=1 while GetTradeSkillInfo(i) do if GetTradeSkillInfo(i) ==\"Fel Iron Chain Gloves\" then DoTradeSkill(i,1) break end i=i+1 end ";
            public string ThreeHundredAndTwentyFour = "local i=1 while GetTradeSkillInfo(i) do if GetTradeSkillInfo(i) ==\"Fel Iron Plate Boots\" then DoTradeSkill(i,1) break end i=i+1 end ";
            public string ThreeHundredAndTwentyNine = "local i=1 while GetTradeSkillInfo(i) do if GetTradeSkillInfo(i) ==\"Lesser Rune of Warding\" then DoTradeSkill(i,1) break end i=i+1 end ";
            public string ThreeHundredAndThirtyFour = "local i=1 while GetTradeSkillInfo(i) do if GetTradeSkillInfo(i) ==\"Fel Iron Breastplate\" then DoTradeSkill(i,1) break end i=i+1 end ";
            public string ThreeHundredAndThirtyNine = "local i=1 while GetTradeSkillInfo(i) do if GetTradeSkillInfo(i) ==\"Adamantite Cleaver\" then DoTradeSkill(i,1) break end i=i+1 end ";
            public string ThreeHundredAndFourtyNine = "local i=1 while GetTradeSkillInfo(i) do if GetTradeSkillInfo(i) ==\"Adamantite Rapier\" then DoTradeSkill(i,1) break end i=i+1 end ";
        }

        public class stage6Values
        {
            public uint L425 = 51300;

            public uint cobaltBar = 36916;
            public uint saroniteBar = 36913;
            public uint saroniteOre = 36912;
            public uint crystallizedAir = 37700;
            public uint eternalEarth = 35624;
            public uint eternalWater = 35622;
            public uint eternalShadow = 35627;

            public string ThreeHundredAndFiftyNine = "local i=1 while GetTradeSkillInfo(i) do if GetTradeSkillInfo(i) ==\"Cobalt Boots\" then DoTradeSkill(i,1) break end i=i+1 end ";
            public string ThreeHundredAndSixtyNine = "local i=1 while GetTradeSkillInfo(i) do if GetTradeSkillInfo(i) ==\"Cobalt Triangle Shield\" then DoTradeSkill(i,1) break end i=i+1 end ";
            public string ThreeHundredAndSeventyFour = "local i=1 while GetTradeSkillInfo(i) do if GetTradeSkillInfo(i) ==\"Cobalt Legplates\" then DoTradeSkill(i,1) break end i=i+1 end ";
            public string ThreeHundredAndSeventyNine = "local i=1 while GetTradeSkillInfo(i) do if GetTradeSkillInfo(i) ==\"Cobalt Gauntlets\" then DoTradeSkill(i,1) break end i=i+1 end ";
            public string ThreeHundredAndEightyFour = "local i=1 while GetTradeSkillInfo(i) do if GetTradeSkillInfo(i) ==\"Spiked Cobalt Boots\" then DoTradeSkill(i,1) break end i=i+1 end ";
            public string ThreeHundredAndEightyNine = "local i=1 while GetTradeSkillInfo(i) do if GetTradeSkillInfo(i) ==\"Sure-fire Shuriken\" then DoTradeSkill(i,1) break end i=i+1 end ";
            public string ThreeHundredAndNinityFour = "local i=1 while GetTradeSkillInfo(i) do if GetTradeSkillInfo(i) ==\"Notched Cobalt War Axe\" then DoTradeSkill(i,1) break end i=i+1 end ";
            public string ThreeHundredAndNinityNine = "local i=1 while GetTradeSkillInfo(i) do if GetTradeSkillInfo(i) ==\"Brilliant Saronite Belt\" then DoTradeSkill(i,1) break end i=i+1 end ";
            public string FourHundredAndFour = "local i=1 while GetTradeSkillInfo(i) do if GetTradeSkillInfo(i) ==\"Horned Cobalt Helm\" then DoTradeSkill(i,1) break end i=i+1 end ";
            public string FourHundredAndFourteen = "local i=1 while GetTradeSkillInfo(i) do if GetTradeSkillInfo(i) ==\"Deadly Saronite Dirk\" then DoTradeSkill(i,1) break end i=i+1 end ";
            public string FourHundredAndTwentyFour = "local i=1 while GetTradeSkillInfo(i) do if GetTradeSkillInfo(i) ==\"Eternal Belt Buckle\" then DoTradeSkill(i,1) break end i=i+1 end ";
        }

        public class stage7Values
        {
            public uint L525 = 76666;

            public uint obsidiumBar = 54849;
            public uint foldedObsidium = 65365;
            public uint volatileEarth = 52327;
            public uint volatileFire = 52325;
            public uint volatileWater = 52326;
            public uint elementiumBar = 52186;

            public string FourHundredAndFiftyFour = "local i=1 while GetTradeSkillInfo(i) do if GetTradeSkillInfo(i) ==\"Folded Obsidium\" then DoTradeSkill(i,1) break end i=i+1 end ";
            public string FourHundredAndFiftyEight = "local i=1 while GetTradeSkillInfo(i) do if GetTradeSkillInfo(i) ==\"Stormforged Gauntlets\" then DoTradeSkill(i,1) break end i=i+1 end ";
            public string FourHundredAndSixtyOne = "local i=1 while GetTradeSkillInfo(i) do if GetTradeSkillInfo(i) ==\"Stormforged Gauntlets\" then DoTradeSkill(i,1) break end i=i+1 end ";
            public string FourHundredAndSixtyNine = "local i=1 while GetTradeSkillInfo(i) do if GetTradeSkillInfo(i) ==\"Stormforged Belt\" then DoTradeSkill(i,1) break end i=i+1 end ";
            public string FourHundredAndSeventyFour = "local i=1 while GetTradeSkillInfo(i) do if GetTradeSkillInfo(i) ==\"Obsidium Bladespear\" then DoTradeSkill(i,1) break end i=i+1 end ";
            public string FourHundredAndSeventyNine = "local i=1 while GetTradeSkillInfo(i) do if GetTradeSkillInfo(i) ==\"Cold-Forged Shank\" then DoTradeSkill(i,1) break end i=i+1 end ";
            public string FourHundredAndEightyEight = "local i=1 while GetTradeSkillInfo(i) do if GetTradeSkillInfo(i) ==\"Stormforged Legguards\" then DoTradeSkill(i,1) break end i=i+1 end ";
            public string FourHundredAndNinityThree = "local i=1 while GetTradeSkillInfo(i) do if GetTradeSkillInfo(i) ==\"Fire Etched Dagger\" then DoTradeSkill(i,1) break end i=i+1 end ";
            public string FourHundredAndNinityNine = "local i=1 while GetTradeSkillInfo(i) do if GetTradeSkillInfo(i) ==\"Stormforged Helm\" then DoTradeSkill(i,1) break end i=i+1 end ";
            public string FiveHundredAndEleven = "local i=1 while GetTradeSkillInfo(i) do if GetTradeSkillInfo(i) ==\"Redsteel Breastplate\" then DoTradeSkill(i,1) break end i=i+1 end ";
            public string FiveHundredAndFourteen = "local i=1 while GetTradeSkillInfo(i) do if GetTradeSkillInfo(i) ==\"Vicious Ornate Pyrium Gauntlets\" then DoTradeSkill(i,1) break end i=i+1 end ";
            public string FiveHundredAndNineteen = "local i=1 while GetTradeSkillInfo(i) do if GetTradeSkillInfo(i) ==\"Vicious Ornate Pyrium Belt\" then DoTradeSkill(i,1) break end i=i+1 end ";
            public string FiveHundredAndTwentyFour = "local i=1 while GetTradeSkillInfo(i) do if GetTradeSkillInfo(i) ==\"Vicious Ornate Pyrium Shoulders\" then DoTradeSkill(i,1) break end i=i+1 end ";
        }

        #region PropertysOfPlugin
        public override string Name { get { return "1-525 Blacksmithing"; } }
        public override string Author { get { return "Giwin"; } }
        public override Version Version { get { return new Version(1, 2); } }
        public override bool WantButton { get { return false; } }
        private static LocalPlayer intMe { get { return ObjectManager.Me; } }
        #endregion

        public override void Pulse()
        {
            if (StyxWoW.Me == null || !StyxWoW.Me.IsAlive || !StyxWoW.IsInGame || !StyxWoW.IsInWorld) return;
            {
                Train();
            }
        }

        public void Train()
        {
            trainValues myValue = new trainValues();

            if (StyxWoW.Me.IsAlliance)
            {
                var TrainNPC = myValue.WoWUnitList.SingleOrDefault(x => x.Entry == myValue.TrainAllianceNPCEntry);

                Navigator.MoveTo(TrainNPC.Location);

                if (TrainNPC.WithinInteractRange)
                {
                    Logging.Write("Speaking with Therum Deepforge");
                    TrainNPC.Interact();
                    Lua.DoString("SelectGossipOption(1)"); // FOR LEVEL 200 AND UP
                    Thread.Sleep(500);
                    Lua.DoString("BuyTrainerService(0);");
                    Thread.Sleep(1000);
                    Lua.DoString("BuyTrainerService(1);");
                    Logging.Write("Training new spells...");
                }
                CheckLevel();
            }
            else
            {
                var TrainNPC = myValue.WoWUnitList.SingleOrDefault(x => x.Entry == myValue.TrainHordeNPCEntry);

                Navigator.MoveTo(TrainNPC.Location);

                if (TrainNPC.WithinInteractRange)
                {
                    Logging.Write("Speaking with Therum Deepforge");
                    TrainNPC.Interact();
                    Lua.DoString("BuyTrainerService(0);");
                    Thread.Sleep(1000);
                    Lua.DoString("BuyTrainerService(1);");
                    Logging.Write("Training new spells...");
                }
            }
            CheckLevel();
        }

        public void CheckLevel()
        {
            blacksmithingLevel myValue = new blacksmithingLevel();

            Thread.Sleep(3000);
            Logging.Write("Checking our Blacksmithing Level...");

            if (myValue.bsLevel == 1 || myValue.bsLevel > 1 && myValue.bsLevel <= 74) // Greater or Equal to 1, Less than or Equal to 75 // 1-75
            {
                Stage1(); // 1 to 75
            }
            else if (myValue.bsLevel >= 75 && myValue.bsLevel <= 124) // Greater or Equal to 305, Less than or Equal to 315 // 305-315
            {
                Stage2(); // 75 to 125    
            }
            else if (myValue.bsLevel >= 125 && myValue.bsLevel <= 199) // Greater or Equal to 305, Less than or Equal to 315 // 305-315
            {
                Stage3(); // 125 to 200   
            }
            else if (myValue.bsLevel >= 200 && myValue.bsLevel <= 299) // Greater or Equal to 305, Less than or Equal to 315 // 305-315
            {
                Stage4(); // 200 to 300    
            }
            else if (myValue.bsLevel >= 300 && myValue.bsLevel <= 349) // Greater or Equal to 305, Less than or Equal to 315 // 305-315
            {
                Stage5(); // 300 to 350    
            }
            else if (myValue.bsLevel >= 350 && myValue.bsLevel <= 424) // Greater or Equal to 305, Less than or Equal to 315 // 305-315
            {
                Stage6(); // 350 to 425    
            }
            else if (myValue.bsLevel >= 425 && myValue.bsLevel <= 524) // Greater or Equal to 305, Less than or Equal to 315 // 305-315
            {
                Stage7(); // 425 to 525    
            }
        }

        public void Stage1() // 1-75
        {
            stage1Values myValue = new stage1Values();
            blacksmithingLevel bsLevel = new blacksmithingLevel();

            var countRoughStone = ObjectManager.GetObjectsOfType<WoWItem>().Count(o => o.Entry == myValue.roughStone);
            var countCopperBar = ObjectManager.GetObjectsOfType<WoWItem>().Count(o => o.Entry == myValue.copperBar);

            foreach (WoWItem i in intMe.BagItems)
            {
                Logging.Write("Stage 1 - Items Required: 133 Rough Stone, 50 Copper Bars"); //+ "| Items Acquired: {0} Rough Stone, {1} Copper Bars", countRoughStone, countRoughStone);
                if (bsLevel.bsLevel > 0 && bsLevel.bsLevel <= 29 && i.Entry == myValue.roughStone && !intMe.IsCasting && !intMe.IsMoving) // Greater or Equal to 1, Less than or Equal to 30 // 1-30
                {
                    Logging.Write("Creating Rough Sharpening Stone until blacksmithing level 30");
                    Lua.DoString(bsLevel.bs);
                    Lua.DoString(myValue.Thirty);
                    Train();
                }
                else if (bsLevel.bsLevel >= 30 && bsLevel.bsLevel <= 64 && i.Entry == myValue.roughStone && !intMe.IsCasting && !intMe.IsMoving) // Greater or Equal to 30, Less than or Equal to 65 // 30-65
                {
                    Logging.Write("Creating Rough Grinding Stone until blacksmithing level 65");
                    Lua.DoString(bsLevel.bs);
                    Lua.DoString(myValue.SixtyFour);
                    Train();
                }
                else if (bsLevel.bsLevel >= 65 && bsLevel.bsLevel <= 74 && i.Entry == myValue.copperBar && !intMe.IsCasting && !intMe.IsMoving) // Greater or Equal to 65, Less than or Equal to 75 // 65-75
                {
                    Logging.Write("Creating Copper Chain Belt until blacksmithing level 75");
                    Lua.DoString(bsLevel.bs);
                    Lua.DoString(myValue.SeventyFour);
                    Train();

                }
                else if (bsLevel.bsLevel == 75)
                {
                    Train();
                }

            }
        }
        public void Stage2() // 75-125
        {
            stage2Values myValue = new stage2Values();
            blacksmithingLevel bsLevel = new blacksmithingLevel();

            ObjectManager.Update();

            var countCoarseStone = ObjectManager.GetObjectsOfType<WoWItem>().Where(o => o.ItemInfo.Id == myValue.coarseStones);
            var countSilverBar = ObjectManager.GetObjectsOfType<WoWItem>().Where(o => o.ItemInfo.Id == myValue.silverBar);
            var countRoughGrindingStone = ObjectManager.GetObjectsOfType<WoWItem>().Where(o => o.ItemInfo.Id == myValue.roughGrindingStone);
            var countBronzeBar = ObjectManager.GetObjectsOfType<WoWItem>().Where(o => o.ItemInfo.Id == myValue.bronzeBar);
            var countCopperBar = ObjectManager.GetObjectsOfType<WoWItem>().Where(o => o.ItemInfo.Id == myValue.copperBar);
            Logging.Write("Items Required: 70 Coarse Stone, 130 Copper Bar, 7 Silver Bars, 14 Rough Grinding Stone, 75 Bronze Bar");  //"| Items Acquired: {0} Coarse Stone, {1} Copper Bars, {2} Silver Bars, {3} Rough Grinding Stone, {4} Bronze Bars", countCoarseStone, countCopperBar, countRoughGrindingStone, countBronzeBar);


            foreach (WoWItem i in intMe.BagItems)
            {
                if (bsLevel.bsLevel >= 75 && bsLevel.bsLevel <= 89 && i.Entry == myValue.coarseStones && !intMe.IsCasting && !intMe.IsMoving) // Greater or Equal to 75, Less than or Equal to 90 // 75-90
                {
                        Logging.Write("Creating Coarse Grinding Stone until blacksmithing level 90");
                        Lua.DoString(bsLevel.bs);
                        Lua.DoString(myValue.EightyNine);
                        Train();
                }
                else if (bsLevel.bsLevel >= 90 && bsLevel.bsLevel <= 99 && i.Entry == myValue.copperBar && !intMe.IsCasting && !intMe.IsMoving) // Greater or Equal to 90, Less than or Equal to 100 // 90-100
                {
                    Logging.Write("Creating Runed Copper Belt until blacksmithing level 100");
                    Lua.DoString(bsLevel.bs);
                    Lua.DoString(myValue.NinityNine);
                    Train();
                }
                else if (bsLevel.bsLevel >= 100 && bsLevel.bsLevel <= 106 && i.Entry == myValue.silverBar && !intMe.IsCasting && !intMe.IsMoving) // Greater or Equal to 100, Less than or Equal to 107 // 100-107
                {
                    Logging.Write("Creating Silver Rod until blacksmithing level 107");
                    Lua.DoString(bsLevel.bs);
                    Lua.DoString(myValue.OneHundredAndSix);
                    Train();
                }
                else if (bsLevel.bsLevel >= 107 && bsLevel.bsLevel <= 109 && i.Entry == myValue.copperBar && !intMe.IsCasting && !intMe.IsMoving) // Greater or Equal to 107, Less than or Equal to 110 // 107-110
                {
                    Logging.Write("Creating Runed Copper Belt until blacksmithing level 110");
                    Lua.DoString(bsLevel.bs);
                    Lua.DoString(myValue.OneHundredAndNine);
                    Train();
                        
                }
                else if (bsLevel.bsLevel >= 110 && bsLevel.bsLevel <= 124 && i.Entry == myValue.bronzeBar && !intMe.IsCasting && !intMe.IsMoving) // Greater or Equal to 110, Less than or Equal to 125 // 110-125
                {
                    Logging.Write("Creating Rough Bronze Shoulders until blacksmithing level 125");
                    Lua.DoString(bsLevel.bs);
                    Lua.DoString(myValue.OneHundredAndTwentyFour);
                    Train();
                        
                }
                else if (bsLevel.bsLevel == 125)
                {
                    Train();
                }
            }
        }
        public void Stage3() // 125-200
        {
            stage2Values myValue = new stage2Values();
            blacksmithingLevel bsLevel = new blacksmithingLevel();

            Logging.Write("Items Required: 105 Heavy Stone, 50 Bronze Bar, 50 Coarse Grinding Stone, 5 Gold Bar, 40 Heavy Grinding Stone, 35 Green Dye, 250 Iron Bars, 50 Steel Bars");

            List<WoWItem> item = intMe.BagItems;


            foreach (WoWItem i in item)
            {
                if (bsLevel.bsLevel >= 125 && bsLevel.bsLevel <= 139 && i.Entry == myValue.heavyStone && !intMe.IsCasting && !intMe.IsMoving) // Greater or Equal to 125, Less than or Equal to 140 // 125-140
                {
                    Logging.Write("Creating Heavy Grinding Stone until blacksmithing level 140");
                    Lua.DoString(bsLevel.bs);
                    Lua.DoString(myValue.OneHundredAndThirtyNine);
                    Train();
                }
                else if (bsLevel.bsLevel >= 140 && bsLevel.bsLevel <= 144 && i.Entry == myValue.bronzeBar && !intMe.IsCasting && !intMe.IsMoving) // Greater or Equal to 140, Less than or Equal to 145 // 110-125
                {
                    Logging.Write("Creating Rough Bronze Shoulders until blacksmithing level 145");
                    Lua.DoString(bsLevel.bs);
                    Lua.DoString(myValue.OneHundredAndFourtyFour);
                    Train();
                }
                else if (bsLevel.bsLevel >= 145 && bsLevel.bsLevel <= 149 && i.Entry == myValue.bronzeBar && !intMe.IsCasting && !intMe.IsMoving) // Greater or Equal to 145, Less than or Equal to 150 // 145-150
                {
                    Logging.Write("Creating Patterned Bronze Bracer until blacksmithing level 150");
                    Lua.DoString(bsLevel.bs);
                    Lua.DoString(myValue.OneHundredAndFourtyNine);
                    Train();
                }
                else if (bsLevel.bsLevel >= 150 && bsLevel.bsLevel <= 154 && i.Entry == myValue.goldBar && !intMe.IsCasting && !intMe.IsMoving) // Greater or Equal to 150, Less than or Equal to 155 // 150-155
                {
                    Logging.Write("Creating Golden Rod until blacksmithing level 155");
                    Lua.DoString(bsLevel.bs);
                    Lua.DoString(myValue.OneHundredAndFiftyFour);
                    Train();
                }
                else if (bsLevel.bsLevel >= 155 && bsLevel.bsLevel <= 164 && i.Entry == myValue.ironBar && !intMe.IsCasting && !intMe.IsMoving) // Greater or Equal to 155, Less than or Equal to 165 // 155-165
                {
                    Logging.Write("Creating Green Iron Leggings until blacksmithing level 165");
                    Lua.DoString(bsLevel.bs);
                    Lua.DoString(myValue.OneHundredAndSixtyFour);
                    Train();
                }
                else if (bsLevel.bsLevel >= 165 && bsLevel.bsLevel <= 189 && i.Entry == myValue.ironBar && !intMe.IsCasting && !intMe.IsMoving) // Greater or Equal to 165, Less than or Equal to 190 // 165-190
                {
                    Logging.Write("Creating Green Iron Bracers until blacksmithing level 190");
                    Lua.DoString(bsLevel.bs);
                    Lua.DoString(myValue.OneHundredAndEightyNine);
                    Train();
                }
                else if (bsLevel.bsLevel >= 190 && bsLevel.bsLevel <= 199 && i.Entry == myValue.steelBar && !intMe.IsCasting && !intMe.IsMoving) // Greater or Equal to 190, Less than or Equal to 200 // 190-200
                {
                    Logging.Write("Creating Golden Scale Bracer until blacksmithing level 200");
                    Lua.DoString(bsLevel.bs);
                    Lua.DoString(myValue.OneHundredAndNinityNine);
                    Train();
                }
                else if (bsLevel.bsLevel == 200)
                {
                    Train();
                }
            }
        }
        public void Stage4() // 200-300
        {
            stage4Values myValue = new stage4Values();
            blacksmithingLevel bsLevel = new blacksmithingLevel();

            Logging.Write("Items Required: 20 Solid Stone, 640 Mithril Bars, 150 Mageweave Cloth, 20 Dense Stone, 540 Thorium Bar, 10 Star Ruby, 100 Rugged Leather");

            foreach (WoWItem i in intMe.BagItems)
            {
                if (bsLevel.bsLevel >= 200 && bsLevel.bsLevel <= 209 && i.Entry == myValue.solidStone && !intMe.IsCasting && !intMe.IsMoving) // Greater or Equal to 200, Less than or Equal to 210 // 200-210
                {
                    Logging.Write("Creating Solid Sharpening Stone until blacksmithing level 210");
                    Lua.DoString(bsLevel.bs);
                    Lua.DoString(myValue.TwoHundredAndNine);
                    Train();
                }
                else if (bsLevel.bsLevel >= 210 && bsLevel.bsLevel <= 224 && i.Entry == myValue.mithrilBar && !intMe.IsCasting && !intMe.IsMoving) // Greater or Equal to 210, Less than or Equal to 225 // 210-225
                {
                    Logging.Write("Creating Heavy Mithril Gauntlet until blacksmithing level 225");
                    Lua.DoString(bsLevel.bs);
                    Lua.DoString(myValue.TwoHundredAndTwentyFour);
                    Train();
                }
                else if (bsLevel.bsLevel >= 225 && bsLevel.bsLevel <= 234 && i.Entry == myValue.mithrilBar && !intMe.IsCasting && !intMe.IsMoving) // Greater or Equal to 225, Less than or Equal to 235 // 225-235
                {
                    if (intMe.IsHorde)
                    {
                        Logging.Write("Please buy the Recipe 'Plans: Mithril Scale Bracers' at 'Swamp of Sorrows' from 'Gharash' <Blacksmithing Supplies>");
                        Logging.Write("Respawn timer: 0:20:00 to 2:15:00 for the Plans... sorry");
                    }
                    else if (intMe.IsAlliance)
                    {
                        Logging.Write("Please buy the Recipe 'Plans: Mithril Scale Bracers' at 'The Hinterlands' from 'Harggan' <Blacksmithing Supplies>");
                        Logging.Write("Respawn timer: 0:20:00 to 2:15:00 for the Plans... sorry");
                    }
                    Logging.Write("Creating Mithril Scale Bracers until blacksmithing level 235");
                    Lua.DoString(bsLevel.bs);
                    Lua.DoString(myValue.TwoHundredAndThirtyFour);
                    Train();
                }
                else if (bsLevel.bsLevel >= 235 && bsLevel.bsLevel <= 249 && i.Entry == myValue.mithrilBar && !intMe.IsCasting && !intMe.IsMoving) // Greater or Equal to 235, Less than or Equal to 250 // 235-250
                {
                    Logging.Write("Creating Mithril Coif until blacksmithing level 250");
                    Lua.DoString(bsLevel.bs);
                    Lua.DoString(myValue.TwoHundredAndFourtyNine);
                    Train();
                }
                else if (bsLevel.bsLevel >= 250 && bsLevel.bsLevel <= 259 && i.Entry == myValue.denseStone && !intMe.IsCasting && !intMe.IsMoving) // Greater or Equal to 250, Less than or Equal to 260 // 250-260
                {
                    Logging.Write("Creating Dense Sharpening Stone until blacksmithing level 260");
                    Lua.DoString(bsLevel.bs);
                    Lua.DoString(myValue.TwoHundredAndFiftyNine);
                    Train();
                }
                else if (bsLevel.bsLevel >= 260 && bsLevel.bsLevel <= 274 && i.Entry == myValue.thoriumBar && !intMe.IsCasting && !intMe.IsMoving) // Greater or Equal to 260, Less than or Equal to 275 // 260-275
                {
                    Logging.Write("Creating Thorium Bracer until blacksmithing level 275");
                    Lua.DoString(bsLevel.bs);
                    Lua.DoString(myValue.TwoHundredAndSeventyFour);
                    Train();
                }
                else if (bsLevel.bsLevel >= 275 && bsLevel.bsLevel <= 289 && i.Entry == myValue.thoriumBar && !intMe.IsCasting && !intMe.IsMoving) // Greater or Equal to 275, Less than or Equal to 290 // 275-290
                {
                    Logging.Write("Creating Imperial Plate Bracer until blacksmithing level 290");
                    Lua.DoString(bsLevel.bs);
                    Lua.DoString(myValue.TwoHundredAndEightyNine);
                    Train();
                }
                else if (bsLevel.bsLevel >= 290 && bsLevel.bsLevel <= 299 && i.Entry == myValue.thoriumBar && !intMe.IsCasting && !intMe.IsMoving) // Greater or Equal to 290, Less than or Equal to 300 // 290-300
                {
                    Logging.Write("Creating Thorium Boot until blacksmithing level 300");
                    Lua.DoString(bsLevel.bs);
                    Lua.DoString(myValue.TwoHundredAndNinityNine);
                    Train();
                }
                else if (bsLevel.bsLevel == 300)
                {
                    Train();
                }
            }
        }
        public void Stage5() // 300-350
        {
            stage5Values myValue = new stage5Values();
            blacksmithingLevel bsLevel = new blacksmithingLevel();

            Logging.Write("Items Required: 7 Netherweave Cloth, 152 Fel Iron Bar, 200 Adamantite Bar");

            foreach (WoWItem i in intMe.BagItems)
            {
                if (bsLevel.bsLevel >= 300 && bsLevel.bsLevel <= 304 && i.Entry == myValue.felIronBar && !intMe.IsCasting && !intMe.IsMoving) // Greater or Equal to 300, Less than or Equal to 305 // 300-305
                {
                    Logging.Write("Creating Fel Weightstone until blacksmithing level 305");
                    Lua.DoString(bsLevel.bs);
                    Lua.DoString(myValue.ThreeHundredAndFour);
                    Train();
                }
                else if (bsLevel.bsLevel >= 305 && bsLevel.bsLevel <= 314 && i.Entry == myValue.felIronBar && !intMe.IsCasting && !intMe.IsMoving) // Greater or Equal to 305, Less than or Equal to 315 // 305-315
                {
                    Logging.Write("Creating Fel Iron Plate Belt until blacksmithing level 315");
                    Lua.DoString(bsLevel.bs);
                    Lua.DoString(myValue.ThreeHundredAndFourteen);
                    Train();
                }
                else if (bsLevel.bsLevel >= 315 && bsLevel.bsLevel <= 319 && i.Entry == myValue.felIronBar && !intMe.IsCasting && !intMe.IsMoving) // Greater or Equal to 305, Less than or Equal to 315 // 305-315
                {
                    Logging.Write("Creating Fel Iron Chain Glove until blacksmithing level 320");
                    Lua.DoString(bsLevel.bs);
                    Lua.DoString(myValue.ThreeHundredAndNineteen);
                    Train();
                }
                else if (bsLevel.bsLevel >= 320 && bsLevel.bsLevel <= 324 && i.Entry == myValue.felIronBar && !intMe.IsCasting && !intMe.IsMoving) // Greater or Equal to 320, Less than or Equal to 325 // 320-325
                {
                    Logging.Write("Creating Fel Iron Plate Boot until blacksmithing level 325");
                    Lua.DoString(bsLevel.bs);
                    Lua.DoString(myValue.ThreeHundredAndTwentyFour);
                    Train();
                }
                else if (bsLevel.bsLevel >= 325 && bsLevel.bsLevel <= 329 && i.Entry == myValue.adamantiteBar && !intMe.IsCasting && !intMe.IsMoving) // Greater or Equal to 320, Less than or Equal to 325 // 320-325
                {
                    Logging.Write("Creating Lesser Rune of Warding until blacksmithing level 330");
                    Lua.DoString(bsLevel.bs);
                    Lua.DoString(myValue.ThreeHundredAndTwentyNine);
                    Train();
                }
                else if (bsLevel.bsLevel >= 330 && bsLevel.bsLevel <= 334 && i.Entry == myValue.felIronBar && !intMe.IsCasting && !intMe.IsMoving) // Greater or Equal to 320, Less than or Equal to 325 // 320-325
                {
                    Logging.Write("Creating Fel Iron Breastplate until blacksmithing level 335");
                    Lua.DoString(bsLevel.bs);
                    Lua.DoString(myValue.ThreeHundredAndThirtyFour);
                    Train();
                }
                else if (bsLevel.bsLevel >= 335 && bsLevel.bsLevel <= 339 && i.Entry == myValue.adamantiteBar && !intMe.IsCasting && !intMe.IsMoving) // Greater or Equal to 320, Less than or Equal to 325 // 320-325
                {
                    Logging.Write("Please buy the Recipe 'Plans: Adamantite Cleaver' & 'Plans: Adamantite Rapier' at 'Shattrah City, Lower City' from 'Aaron Hollman' <Blacksmithing Supplies>");
                    Logging.Write("Creating Adamantite Cleaver until blacksmithing level 340");
                    Lua.DoString(bsLevel.bs);
                    Lua.DoString(myValue.ThreeHundredAndThirtyNine);
                    Train();
                }
                else if (bsLevel.bsLevel >= 340 && bsLevel.bsLevel <= 349 && i.Entry == myValue.adamantiteBar && !intMe.IsCasting && !intMe.IsMoving) // Greater or Equal to 320, Less than or Equal to 325 // 320-325
                {
                    Logging.Write("Creating Adamantite Rapier until blacksmithing level 350");
                    Lua.DoString(bsLevel.bs);
                    Lua.DoString(myValue.ThreeHundredAndFourtyNine);
                    Train();
                }
                else if (bsLevel.bsLevel == 350)
                {
                    Train();
                }
            }
        }
        public void Stage6() // 350-425
        {
            stage6Values myValue = new stage6Values();
            blacksmithingLevel bsLevel = new blacksmithingLevel();

            Logging.Write("Items Required: 320 Cobalt Bars, 147 Saronite Bars, 20 Crystallized Air, 13 Eternal Earth, 13 Eternal Shadow, 13 Eternal Water");

            foreach (WoWItem i in intMe.BagItems)
            {
                if (bsLevel.bsLevel >= 350 && bsLevel.bsLevel <= 359 && i.Entry == myValue.cobaltBar && !intMe.IsCasting && !intMe.IsMoving) // Greater or Equal to 300, Less than or Equal to 305 // 300-305
                {
                    Logging.Write("Creating Cobalt Boot until blacksmithing level 360");
                    Lua.DoString(bsLevel.bs);
                    Lua.DoString(myValue.ThreeHundredAndFiftyNine);
                    Train();
                }
                else if (bsLevel.bsLevel >= 360 && bsLevel.bsLevel <= 369 && i.Entry == myValue.cobaltBar && !intMe.IsCasting && !intMe.IsMoving) // Greater or Equal to 305, Less than or Equal to 315 // 305-315
                {
                    Logging.Write("Creating Cobalt Triangle Shield until blacksmithing level 370");
                    Lua.DoString(bsLevel.bs);
                    Lua.DoString(myValue.ThreeHundredAndSixtyNine);
                    Train();
                }
                else if (bsLevel.bsLevel >= 370 && bsLevel.bsLevel <= 374 && i.Entry == myValue.cobaltBar && !intMe.IsCasting && !intMe.IsMoving) // Greater or Equal to 305, Less than or Equal to 315 // 305-315
                {
                    Logging.Write("Creating Cobalt Legplates until blacksmithing level 375");
                    Lua.DoString(bsLevel.bs);
                    Lua.DoString(myValue.ThreeHundredAndSeventyFour);
                    Train();
                }
                else if (bsLevel.bsLevel >= 375 && bsLevel.bsLevel <= 379 && i.Entry == myValue.cobaltBar && !intMe.IsCasting && !intMe.IsMoving) // Greater or Equal to 305, Less than or Equal to 315 // 305-315
                {
                    Logging.Write("Creating Cobalt Gauntlets until blacksmithing level 380");
                    Lua.DoString(bsLevel.bs);
                    Lua.DoString(myValue.ThreeHundredAndSeventyNine);
                    Train();
                }
                else if (bsLevel.bsLevel >= 380 && bsLevel.bsLevel <= 384 && i.Entry == myValue.cobaltBar && !intMe.IsCasting && !intMe.IsMoving) // Greater or Equal to 305, Less than or Equal to 315 // 305-315
                {
                    Logging.Write("Creating Spiked Cobalt Boot until blacksmithing level 385");
                    Lua.DoString(bsLevel.bs);
                    Lua.DoString(myValue.ThreeHundredAndEightyFour);
                    Train();
                }
                else if (bsLevel.bsLevel >= 385 && bsLevel.bsLevel <= 389 && i.Entry == myValue.cobaltBar && !intMe.IsCasting && !intMe.IsMoving) // Greater or Equal to 305, Less than or Equal to 315 // 305-315
                {
                    Logging.Write("Creating Sure-fire Shuriken until blacksmithing level 390");
                    Lua.DoString(bsLevel.bs);
                    Lua.DoString(myValue.ThreeHundredAndEightyNine);
                    Train();
                }
                else if (bsLevel.bsLevel >= 390 && bsLevel.bsLevel <= 394 && i.Entry == myValue.cobaltBar && !intMe.IsCasting && !intMe.IsMoving) // Greater or Equal to 305, Less than or Equal to 315 // 305-315
                {
                    Logging.Write("Creating Notched Cobalt War Axe until blacksmithing level 395");
                    Lua.DoString(bsLevel.bs);
                    Lua.DoString(myValue.ThreeHundredAndNinityFour);
                    Train();
                }
                else if (bsLevel.bsLevel >= 395 && bsLevel.bsLevel <= 399 && i.Entry == myValue.cobaltBar && !intMe.IsCasting && !intMe.IsMoving) // Greater or Equal to 305, Less than or Equal to 315 // 305-315
                {
                    Logging.Write("Creating Brilliant Saronite Belt until blacksmithing level 400");
                    Lua.DoString(bsLevel.bs);
                    Lua.DoString(myValue.ThreeHundredAndNinityNine);
                    Train();
                }
                else if (bsLevel.bsLevel >= 400 && bsLevel.bsLevel <= 404 && i.Entry == myValue.cobaltBar && !intMe.IsCasting && !intMe.IsMoving) // Greater or Equal to 305, Less than or Equal to 315 // 305-315
                {
                    Logging.Write("Creating Horned Cobalt Helm until blacksmithing level 405");
                    Lua.DoString(bsLevel.bs);
                    Lua.DoString(myValue.FourHundredAndFour);
                    Train();
                }
                else if (bsLevel.bsLevel >= 405 && bsLevel.bsLevel <= 414 && i.Entry == myValue.saroniteBar && !intMe.IsCasting && !intMe.IsMoving) // Greater or Equal to 305, Less than or Equal to 315 // 305-315
                {
                    Logging.Write("Creating Deadly Saronite Dirk until blacksmithing level 415");
                    Lua.DoString(bsLevel.bs);
                    Lua.DoString(myValue.FourHundredAndFourteen);
                    Train();
                }
                else if (bsLevel.bsLevel >= 415 && bsLevel.bsLevel <= 424 && i.Entry == myValue.saroniteBar && !intMe.IsCasting && !intMe.IsMoving) // Greater or Equal to 305, Less than or Equal to 315 // 305-315
                {
                    Logging.Write("Creating Eternal Belt Buckle until blacksmithing level 425");
                    Lua.DoString(bsLevel.bs);
                    Lua.DoString(myValue.FourHundredAndTwentyFour);
                    Train();
                }
                else if (bsLevel.bsLevel == 425)
                {
                    Train();
                }
            }
        }
        public void Stage7() // 425-525
        {
            stage7Values myValue = new stage7Values();
            blacksmithingLevel bsLevel = new blacksmithingLevel();

            Logging.Write("Items Required: 2 Hardened Elementium Bars, 400 Elementium Bars, 166 Obsidium Bar, 90 Folded Obsidium (Don't buy these, they will be made from Obsidium Bars), 210 Volatile Earth, 276 Volatile Fire, 130 Volatile Water");

            foreach (WoWItem i in intMe.BagItems)
            {
                if (bsLevel.bsLevel >= 425 && bsLevel.bsLevel <= 454 && i.Entry == myValue.obsidiumBar && !intMe.IsCasting && !intMe.IsMoving) // Greater or Equal to 300, Less than or Equal to 305 // 300-305
                {
                    Logging.Write("Creating Folded Obsidium until blacksmithing level 455");
                    Lua.DoString(bsLevel.bs);
                    Lua.DoString(myValue.FourHundredAndFiftyFour);
                    Train();
                }
                else if (bsLevel.bsLevel >= 455 && bsLevel.bsLevel <= 458 && i.Entry == myValue.foldedObsidium && !intMe.IsCasting && !intMe.IsMoving) // Greater or Equal to 305, Less than or Equal to 315 // 305-315
                {
                    Logging.Write("Creating Stormforged Gauntlet until blacksmithing level 459");
                    Lua.DoString(bsLevel.bs);
                    Lua.DoString(myValue.FourHundredAndFiftyEight);
                    Train();
                }
                else if (bsLevel.bsLevel >= 459 && bsLevel.bsLevel <= 461 && i.Entry == myValue.foldedObsidium && !intMe.IsCasting && !intMe.IsMoving) // Greater or Equal to 305, Less than or Equal to 315 // 305-315
                {
                    Logging.Write("Creating Stormforged Gauntlet until blacksmithing level 462");
                    Lua.DoString(bsLevel.bs);
                    Lua.DoString(myValue.FourHundredAndSixtyOne);
                    Train();
                }
                else if (bsLevel.bsLevel >= 462 && bsLevel.bsLevel <= 469 && i.Entry == myValue.foldedObsidium && !intMe.IsCasting && !intMe.IsMoving) // Greater or Equal to 305, Less than or Equal to 315 // 305-315
                {
                    Logging.Write("Creating Stormforged Belt until blacksmithing level 470");
                    Lua.DoString(bsLevel.bs);
                    Lua.DoString(myValue.FourHundredAndSixtyNine);
                    Train();
                }
                else if (bsLevel.bsLevel >= 470 && bsLevel.bsLevel <= 474 && i.Entry == myValue.foldedObsidium && !intMe.IsCasting && !intMe.IsMoving) // Greater or Equal to 305, Less than or Equal to 315 // 305-315
                {
                    Logging.Write("Creating Obsidium Bladespear until blacksmithing level 475");
                    Lua.DoString(bsLevel.bs);
                    Lua.DoString(myValue.FourHundredAndSeventyFour);
                    Train();
                }
                else if (bsLevel.bsLevel >= 475 && bsLevel.bsLevel <= 479 && i.Entry == myValue.foldedObsidium && !intMe.IsCasting && !intMe.IsMoving) // Greater or Equal to 305, Less than or Equal to 315 // 305-315
                {
                    Logging.Write("Creating Cold-Forged Shank until blacksmithing level 480");
                    Lua.DoString(bsLevel.bs);
                    Lua.DoString(myValue.FourHundredAndSeventyNine);
                    Train();
                }
                else if (bsLevel.bsLevel >= 480 && bsLevel.bsLevel <= 488 && i.Entry == myValue.elementiumBar && !intMe.IsCasting && !intMe.IsMoving) // Greater or Equal to 305, Less than or Equal to 315 // 305-315
                {
                    Logging.Write("Creating Stormforged Legguards until blacksmithing level 489");
                    Lua.DoString(bsLevel.bs);
                    Lua.DoString(myValue.FourHundredAndEightyEight);
                    Train();
                }
                else if (bsLevel.bsLevel >= 489 && bsLevel.bsLevel <= 493 && i.Entry == myValue.elementiumBar && !intMe.IsCasting && !intMe.IsMoving) // Greater or Equal to 305, Less than or Equal to 315 // 305-315
                {
                    Logging.Write("Creating Fire Etched Dagger until blacksmithing level 494");
                    Lua.DoString(bsLevel.bs);
                    Lua.DoString(myValue.FourHundredAndNinityThree);
                    Train();
                }
                else if (bsLevel.bsLevel >= 494 && bsLevel.bsLevel <= 499 && i.Entry == myValue.elementiumBar && !intMe.IsCasting && !intMe.IsMoving) // Greater or Equal to 305, Less than or Equal to 315 // 305-315
                {
                    Logging.Write("Creating Stormforged Helm until blacksmithing level 500");
                    Lua.DoString(bsLevel.bs);
                    Lua.DoString(myValue.FourHundredAndNinityNine);
                    Train();
                }
                else if (bsLevel.bsLevel >= 500 && bsLevel.bsLevel <= 511 && i.Entry == myValue.elementiumBar && !intMe.IsCasting && !intMe.IsMoving) // Greater or Equal to 305, Less than or Equal to 315 // 305-315
                {
                    Logging.Write("Creating Redsteel Breastplate until blacksmithing level 512");
                    Lua.DoString(bsLevel.bs);
                    Lua.DoString(myValue.FiveHundredAndEleven);
                    Train();
                }
                else if (bsLevel.bsLevel >= 512 && bsLevel.bsLevel <= 514 && i.Entry == myValue.elementiumBar && !intMe.IsCasting && !intMe.IsMoving) // Greater or Equal to 305, Less than or Equal to 315 // 305-315
                {
                    Logging.Write("Please buy all the 'Vicious' recipes at your local Blacksmithing Supplies (Blacksmithing Trainer) NPC in your major City (excluding Dalaran and Shattrah)");
                    Logging.Write("Creating Vicious Ornate Pyrium Gauntlets until blacksmithing level 515");
                    Lua.DoString(bsLevel.bs);
                    Lua.DoString(myValue.FiveHundredAndFourteen);
                    Train();
                }
                else if (bsLevel.bsLevel >= 515 && bsLevel.bsLevel <= 519 && i.Entry == myValue.elementiumBar && !intMe.IsCasting && !intMe.IsMoving) // Greater or Equal to 305, Less than or Equal to 315 // 305-315
                {
                    Logging.Write("Creating Vicious Ornate Pyrium Belt until blacksmithing level 520");
                    Lua.DoString(bsLevel.bs);
                    Lua.DoString(myValue.FiveHundredAndNineteen);
                    Train();

                }
                else if (bsLevel.bsLevel >= 520 && bsLevel.bsLevel <= 524 && i.Entry == myValue.elementiumBar && !intMe.IsCasting && !intMe.IsMoving) // Greater or Equal to 305, Less than or Equal to 315 // 305-315
                {
                    Logging.Write("Creating Vicious Ornate Pyrium Shoulders until blacksmithing level 525");
                    Lua.DoString(bsLevel.bs);
                    Lua.DoString(myValue.FiveHundredAndTwentyFour);
                    Train();

                }
                else if (bsLevel.bsLevel == 525)
                {
                    Train();
                    Logging.Write("Congratulations, You have reached Blacksmithing Level 525! Please disable this plugin");
                    Thread.Sleep(999999999);
                }
            }
        }
    }
}
